#pragma once
#include "GameScreen.hpp"
#include "Frame.h"
#include "IAnimateable.hpp"

class DuelScreen :
	public rh::GameScreen
{
private:
	static const int FADE_IN_TIME_mS = 600;
	static const int INTRO_WAIT_mS = 550;
	static const int OVERSHADOW_BG = 400;
	static const int SLIDE_IN_BANNER_mS = 500;
	static const int HOLD_BANNER_mS = 300;
	static const int CLEAR_BG_mS = 300;


	enum DuelState 
	{
		Inactive,
		Intro,
		ShowOff,
		Wait,
		Fault,
		Attack,
		Result,
		Outro
	};

	enum IntroState
	{
		FadeIn = 0,
		Wait1,
		OvershadowBg,
		DisplayBanners,
		HoldBanners,
		ClearBanners,
		ClearBg
	};
	
	DuelState _state;
	IntroState _introState;
	rh::IAnimateable* _animations[4];
	sf::Time _transitionTime;

	sf::Texture _mainTexture;

	rh::Frame _player1;
	rh::Frame _player2;

	rh::Frame _background;
	rh::Frame _blackCourtain;

	rh::Frame _neutralBanner1;
	rh::Frame _neutralBanner2;

	rh::Frame _player1Banner;
	rh::Frame _player2Banner;

	rh::Frame _Exclamation;
	rh::Frame _strikeCross;

	void FadeCourtainOut(const sf::Time& elapsedTime);
	void ShowBanners(sf::Time elapsedTime);
	void InitializeState(DuelState state);
public:
	DuelScreen(void);
	~DuelScreen(void);

	virtual void Draw(sf::RenderWindow& renderWindow, const sf::RenderStates & renderState);
	virtual void Update(const sf::Time& elapsedTime, const sf::Time& totalElapsedTime);
	virtual void Initialize(void);
};

